﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace UTSDAL.LINQSQL.Exceptions
{
    public class DAOExceptionHandler
    {
        public static String getMessage(Exception e)
        {
            String msg = null;

            if (e is SqlException)
            {
                if (e.Message.StartsWith("Violation of PRIMARY KEY "))
                {
                    msg = "Cannot insert this record as the same data already exists !";
                }
            }

            return msg;
        }
    }
}
